home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / TowerOfHanoy.dxr / 00003_Disc 1 code.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  3.5 KB  |  100 lines

  1. global gDiscNum, gReleaseBall, gCheckList, gPosX, gPosY, gOriginX, gOriginY, gLeftTowerList, gCenterTowerList, gRightTowerList, gPlaced, gStackSide, gSingle
  2.  
  3. on mouseDown
  4.   puppetSound(1, "pick up piece")
  5.   gDiscNum = 20
  6.   gPosX = the mouseH
  7.   gPosY = the mouseV
  8.   if gPlaced = 1 then
  9.     if (gPosX >= 15) and (gPosX <= 185) and ((gPosY >= 110) and (gPosY <= 385)) then
  10.       gStackSide = 4
  11.       repeat with gCheckList = 1 to 10
  12.         if gLeftTowerList[gCheckList] = 0 then
  13.           if gCheckList = 1 then
  14.             gCheckList = 2
  15.           end if
  16.           if gLeftTowerList[gCheckList - 1] = gDiscNum then
  17.             if gReleaseBall = 1 then
  18.               sprite(gDiscNum).locZ = 35
  19.               sprite(gDiscNum).loc = the mouseLoc
  20.               gOriginX = sprite(gDiscNum).locH
  21.               gOriginY = sprite(gDiscNum).locV
  22.             end if
  23.             gPosX = the mouseH
  24.             gPosY = the mouseV
  25.             gReleaseBall = 0
  26.             if gLeftTowerList[1] <> 0 then
  27.               repeat with gCheckList = 1 to 10
  28.                 if gLeftTowerList[gCheckList] = 0 then
  29.                   gLeftTowerList[gCheckList - 1] = 0
  30.                   exit
  31.                 end if
  32.               end repeat
  33.             end if
  34.           end if
  35.         end if
  36.       end repeat
  37.     else
  38.       if (gPosX >= 202) and (gPosX <= 375) and ((gPosY >= 110) and (gPosY <= 385)) then
  39.         gStackSide = 5
  40.         repeat with gCheckList = 1 to 10
  41.           if gCenterTowerList[gCheckList] = 0 then
  42.             if gCheckList = 1 then
  43.               gCheckList = 2
  44.             end if
  45.             if gCenterTowerList[gCheckList - 1] = gDiscNum then
  46.               if gReleaseBall = 1 then
  47.                 sprite(gDiscNum).locZ = 35
  48.                 sprite(gDiscNum).loc = the mouseLoc
  49.                 gOriginX = sprite(gDiscNum).locH
  50.                 gOriginY = sprite(gDiscNum).locV
  51.               end if
  52.               gPosX = the mouseH
  53.               gPosY = the mouseV
  54.               gReleaseBall = 0
  55.               if gCenterTowerList[1] <> 0 then
  56.                 repeat with gCheckList = 1 to 10
  57.                   if gCenterTowerList[gCheckList] = 0 then
  58.                     gCenterTowerList[gCheckList - 1] = 0
  59.                     exit
  60.                   end if
  61.                 end repeat
  62.               end if
  63.             end if
  64.           end if
  65.         end repeat
  66.       else
  67.         if (gPosX >= 388) and (gPosX <= 561) and ((gPosY >= 110) and (gPosY <= 385)) then
  68.           gStackSide = 6
  69.           repeat with gCheckList = 1 to 10
  70.             if gRightTowerList[gCheckList] = 0 then
  71.               if gCheckList = 1 then
  72.                 gCheckList = 2
  73.               end if
  74.               if gRightTowerList[gCheckList - 1] = gDiscNum then
  75.                 if gReleaseBall = 1 then
  76.                   sprite(gDiscNum).locZ = 35
  77.                   sprite(gDiscNum).loc = the mouseLoc
  78.                   gOriginX = sprite(gDiscNum).locH
  79.                   gOriginY = sprite(gDiscNum).locV
  80.                 end if
  81.                 gPosX = the mouseH
  82.                 gPosY = the mouseV
  83.                 gReleaseBall = 0
  84.                 if gRightTowerList[1] <> 0 then
  85.                   repeat with gCheckList = 1 to 10
  86.                     if gRightTowerList[gCheckList] = 0 then
  87.                       gRightTowerList[gCheckList - 1] = 0
  88.                       exit
  89.                     end if
  90.                   end repeat
  91.                 end if
  92.               end if
  93.             end if
  94.           end repeat
  95.         end if
  96.       end if
  97.     end if
  98.   end if
  99. end
  100.